Skip to content

fix(workflow): improve phase transition routing and progress detection#823

Open
Tibsfox wants to merge 3 commits intogsd-build:mainfrom
Tibsfox:fix/workflow-transitions
Open

fix(workflow): improve phase transition routing and progress detection#823
Tibsfox wants to merge 3 commits intogsd-build:mainfrom
Tibsfox:fix/workflow-transitions

Conversation

@Tibsfox
Copy link
Contributor

@Tibsfox Tibsfox commented Feb 28, 2026

Summary

This PR improves the reliability of GSD's workflow transition layer — the handoffs between planning, execution, verification, and progress routing. Three issues addressed across 3 files, ~64 lines total.


Changes

1. Progress routing: include roadmap phases in init data — Closes #689

The experience: Running /gsd:progress announces "Milestone Complete! All phases finished!" even though 4+ phases remain in the roadmap — they just haven't been scaffolded to disk yet. This has reproduced consistently across multiple sessions for users with multi-phase milestones.

Why it happens: init progress builds its phase overview by scanning .planning/phases/ directories. Phases defined in ROADMAP.md that haven't been planned yet don't have directories, so phase_count and completed_count end up equal. The progress workflow sees completed_count === phase_count and routes to "Milestone Complete."

The issue author identified this clearly: the current_phase, next_phase, phase_count, and completed_count fields from init "look authoritative but only reflect disk state." The LLM treats this output as self-sufficient and skips the roadmap analyze step that would reveal the unscaffolded phases.

The fix: After the disk scan, parse ROADMAP.md for phase headings. Add a roadmap_phase_count field that reflects the true total from the roadmap. When all disk phases are complete but the roadmap defines more, set next_phase to the first unscaffolded phase (with a roadmap_only: true marker so consumers can distinguish it from disk phases). The existing phase_count field stays unchanged — it still means "directories on disk" — so existing consumers aren't affected.

Files: bin/lib/init.cjs (+33 lines)

2. Verify-work routing after execution — Closes #117

The experience: When gsd-verifier returns human_needed, the execute-phase workflow displays a static text block listing items that need manual testing. But the user must manually discover and invoke /gsd:verify-work to actually perform the tests. Users may miss the items entirely, proceed to the next phase without testing, or not realize the phase is unverified.

The fix: Replace the passive text display with an AskUserQuestion offering three clear paths:

  • Start /gsd:verify-work — run the interactive UAT workflow (with /clear recommended for fresh context)
  • Mark all approved — skip manual testing and proceed
  • Review verification report — see the full VERIFICATION.md before deciding

This is complementary to PR #819 (browser pre-verification) — #819 makes the verification process itself smarter, while this fix makes the transition to verification automatic. They work well together.

Files: workflows/execute-phase.md (+16 lines, -8 lines)

3. Execute-phase offer after planning — Closes #136

The experience: After planning completes (in the non-auto-advance case), the workflow shows a static suggestion to run /gsd:execute-phase. The user has to read the suggestion, understand it, and manually invoke the command. This creates an unnecessary friction point in the plan-execute loop.

The fix: Add an AskUserQuestion to the <offer_next> section offering to execute immediately, review plans first, or clear context for a fresh start. This only fires when auto-advance is NOT enabled — the auto-advance path (step 14) already handles the transition automatically.

This is different from autopilot mode (#796): autopilot auto-advances through the full chain without asking. This fix is about the interactive case — offering a choice, not forcing execution. They're complementary features.

Files: workflows/plan-phase.md (+15 lines, -12 lines)


Verification

Fix Steps
#689 Create a project with 12 phases in ROADMAP.md, scaffold phases 1-12, complete all. Run init progress — should show roadmap_phase_count reflecting the full ROADMAP count and next_phase pointing to the first unscaffolded phase.
#117 Run execute-phase on a phase where the verifier returns human_needed. Verify that an AskUserQuestion prompt appears offering /gsd:verify-work, "Mark approved", or "Review report".
#136 Run plan-phase WITHOUT --auto. After planning completes, verify an AskUserQuestion prompt appears in <offer_next> offering to execute, review plans, or clear context.

Overlap & Conflict Notes

This PR touches workflow files that are also modified by several active PRs from ethan-hurst:

Our diff is small (~64 lines) and each commit is atomic, so rebasing after any of these merge should be straightforward. The maintainer can also cherry-pick individual commits if preferred.

Relationship to PR #822

PR #822 fixes the foundation-level bugs (phase lifecycle scanning, milestone detection, state parsing) that these workflow improvements depend on. Specifically:

These PRs can merge independently, but together they address the full chain from data layer through workflow routing.

v2 Changes (rebase on main after #826)

Rebased on current main per reviewer request. The rebase applied cleanly — no conflicts.

Regarding "commit recovery sections": After inspecting all three commits, neither discuss-phase.md nor plan-phase.md contain any commit recovery content. The branch has zero changes to discuss-phase.md. The plan-phase.md change only touches the <offer_next> section (replacing static "Next Up" text with AskUserQuestion routing), which is independent of #826's auto-advance <process> section. Both sections coexist cleanly.


🤖 Generated with Claude Code

Copy link
Collaborator

@glittercowboy glittercowboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Notes

#826 has been merged (Skill instead of Task for auto-advance), which affects this PR:

1. Progress detection (init.cjs) — Still valuable. The roadmap-aware phase counting is independent of the nesting changes.

2. Commit recovery (discuss-phase.md, plan-phase.md) — Now redundant. Since #826 eliminates deep Task nesting (using flat Skill calls instead), there are no deeply-nested agents whose commits could get lost. These files also now conflict with #826's changes.

3. AskUserQuestion routing (execute-phase.md, plan-phase.md) — Still a nice UX improvement, but plan-phase.md conflicts with #826.

Requested action: Rebase on main, drop the commit recovery sections from discuss-phase.md and plan-phase.md (no longer applicable), and resolve the merge conflicts in plan-phase.md with #826's Skill-based auto-advance.

@Tibsfox Tibsfox force-pushed the fix/workflow-transitions branch from fd0b6e8 to c4a574a Compare March 4, 2026 08:08
@Tibsfox Tibsfox changed the title fix(workflow): improve phase transition routing, progress detection, and commit recovery fix(workflow): improve phase transition routing and progress detection Mar 4, 2026
Tibsfox and others added 3 commits March 4, 2026 07:17
init progress only counts phase directories on disk, so when all
scaffolded phases are complete but ROADMAP.md defines more, the
output shows completed_count === phase_count with next_phase: null.
The progress workflow interprets this as "Milestone Complete" even
when unscaffolded phases remain.

Parse ROADMAP.md phase headings after the disk scan. Add a
roadmap_phase_count field for the true total, and when all disk phases
are complete, set next_phase to the first unscaffolded roadmap phase
with a roadmap_only:true marker so consumers can distinguish it.

Closes gsd-build#689

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When gsd-verifier returns human_needed, the execute-phase workflow
displays a static text block listing test items but requires the user
to manually discover and invoke /gsd:verify-work. Users may miss the
items, proceed without testing, or not realize the phase is unverified.

Replace the passive display with an AskUserQuestion offering three
clear paths: start the verify-work UAT workflow, mark all items as
approved, or review the full verification report before deciding.

Closes gsd-build#117

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the static "Next Up" suggestion in <offer_next> with an
AskUserQuestion offering to execute immediately, review plans, or
clear context first. This only fires in the non-auto-advance case
(auto-advance already handles the transition). Closes gsd-build#136

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Tibsfox Tibsfox force-pushed the fix/workflow-transitions branch 2 times, most recently from c4a574a to 9e33fa5 Compare March 4, 2026 15:20
@Tibsfox
Copy link
Contributor Author

Tibsfox commented Mar 4, 2026

Hey! Rebased on main — applied cleanly, all three commits preserved. Here's the rundown on each point:

1. Progress detection (init.cjs) — Agreed, completely independent of #826. Rebased without conflict.

2. Commit recovery sections — Investigated this thoroughly: the branch has zero changes to discuss-phase.md and no commit recovery content in plan-phase.md. The plan-phase.md change only touches the <offer_next> section (static "Next Up" → AskUserQuestion routing). This may have been from an earlier version of the PR that got revised before submission — either way, nothing to drop.

3. AskUserQuestion routing — Both files rebased cleanly. In plan-phase.md, the branch's <offer_next> change and #826's auto-advance <process> section are in separate blocks — they coexist without conflict. The AskUserQuestion only fires in the non-auto-advance path, so the two features are complementary.

Tests passing (535/535). Ready for another look when you get a chance!

  • Tibsfox ^.^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants